import 'package:boss/ui/page/commodity/classificationManagement/page/classificationDetail/provider/classification_detail_provider.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'classification_detail_material_item.dart';

class ClassificationDetailMaterialList extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Consumer<ClassificationDetailProvider>(
      builder: (context, classificationDetailProvider, child) {
        return ListView.builder(
          padding: EdgeInsets.symmetric(
            horizontal: 25.w,
          ),
          shrinkWrap: true,
          physics: NeverScrollableScrollPhysics(),
          itemBuilder: (context, index) {
            var current = classificationDetailProvider
                .menu.commodityMeterialList[index];

            return ClassificationDetailMaterialItem(
              data: current,
              onDelete: () {
                classificationDetailProvider.deleteMaterial(current);
              },
            );
          },
          itemCount:
          classificationDetailProvider.menu.commodityMeterialList.length,
        );
      },
    );
  }
}
